How to join two tables with dates conditions with SQL and Python

visit shbcf.ru